﻿@model XRepair.Models.Symptom
@using xCache = MvcXRepairAdmin.CacheData

@{
    Layout = null;

    List<XRepair.Models.Brand> activeBrands = xCache.Cache.GetAllActiveBrands();

    var brandTypes = activeBrands.ConvertAll<SelectListItem>(x => new SelectListItem { Value = x.ID.Value.ToString(), Text = x.BrandName });

    brandTypes.Insert(0, new SelectListItem { Value = string.Empty, Text = "Select brand", Selected = true });
}

@using (Html.BeginForm("Edit", "Symptom", FormMethod.Post))
{
    <table>
        <tbody>
            <tr>
                <td>Brand</td>
                <td>@Html.DropDownListFor(x => x.BrandID, brandTypes)</td>
            </tr>
            <tr>
                <td>Model</td>
                <td>@Html.DropDownListFor(x => x.ModelID, new List<SelectListItem> { new SelectListItem { Value = string.Empty, Text = "Waiting for selected brand" } })</td>
            </tr>
            <tr>
                <td>Symptom Name</td>
                <td>
                    @Html.TextBoxFor(x => x.Name)</td>
            </tr>

            <tr>
                <td>Description</td>
                <td>
                    @Html.TextAreaFor(x => x.Description, new { cols = 10, rows = 4 }) </td>
            </tr>
        </tbody>
    </table>
    
    @Html.HiddenFor(x => x.ID);
    
    <input type="submit" value="Update" /><input type="button" value="Cancel" id="btnCancelEdit" />
}
